fix: resolve UnboundLocalError and eval assignment bug in load_available_input_data#49
Open
RohitMurali18 wants to merge 1 commit intoNVlabs:mainfrom
Open
fix: resolve UnboundLocalError and eval assignment bug in load_available_input_data#49RohitMurali18 wants to merge 1 commit intoNVlabs:mainfrom
RohitMurali18 wants to merge 1 commit intoNVlabs:mainfrom
Conversation
1. Initialize cam_K to None so the function doesn't raise UnboundLocalError when K is None and the loaded file has no 'K' key. 2. Assign eval(K) back to K (not cam_K) so the subsequent np.array(K).reshape(3,3) operates on the parsed list instead of the original string, which would fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fixes
1. UnboundLocalError when
Kis None and file has no'K'keycam_Kwas referenced before assignment in the case whereK=Noneand the loaded
.npyfile doesn't contain a'K'key.Fixed by initializing
cam_K = Noneat the top of the block.2.
eval(K)result discarded —np.array(K).reshape(3,3)fails on raw stringeval(K)was called but assigned tocam_Kinstead of back toK,so the subsequent
np.array(K).reshape(3,3)was still operating onthe original string. Fixed by assigning
eval(K)back toK.Impact
Both bugs cause silent or hard crashes during data loading,
particularly when running inference on custom camera setups.